﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Lemonc.Data
{
    public interface IDBAccess
    {

        IDbConnection connection { get; }

        IDbTransaction DBTransaction
        {
            get;
            set;
        }
        DBAccessType DBType
        {
            get;
            set;
        }
        bool OpenConnection();
        bool CloseConnection();
        int ExecuteNonQueryByText(string commandText, IDataParameter[] paraList);
        IDataReader ExecuteReaderByText(string selectCommandText, IDataParameter[] paraList);
        object ExecuteScalarByText(string selectCommandText, IDataParameter[] paraList);
        int ExecuteNonQueryByProc(string procName, IDataParameter[] paraList);
        IDataReader ExecuteReaderByProc(string selectProcName, IDataParameter[] paraList);
        object ExecuteScalarByProc(string selectProcName, IDataParameter[] paraList);
        DataTable ExecuteDataTableByText(string selectCommandText, IDataParameter[] paraList);
        DataTable ExecuteDataTableByProc(string selectProcName, IDataParameter[] paraList);
        IDbDataAdapter GetDbDataAdapterBySelectSql(string sql, IDataParameter[] paraList);
        DbCommandBuilder GetDbCommandBuilder(IDbDataAdapter da);
        IDbCommand CreateDbCommand(string commandText, CommandType type, IDataParameter[] paraList);
    }
}
